<?php

Raise::load('core.helper.RaiseHelper');
Raise::load('IRaiseConverter');

/**
 * RaiseUnitConverter class
 * for unit conversion
 * 
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package phpraise.core.helper.convert
 * @since 1.2
 * @abstract
 */
abstract class RaiseUnitConverter extends RaiseHelper implements IRaiseConverter {
    
    /**
     * The conversion from
     * @var string|integer|double
     */
    private $to;
    
    /**
     * The conversion to
     * @var string|integer|double
     */
    private $from;
    
    /**
     * Create a new unit converter
     * @param string|integer|double $from The unit to be converted from
     * @param string|integer|double $to  The unit to convert to
     */
    function __construct($from, $to) {
        $this->from = $from;
        $this->to = $to;
        if($this->from == $this->to){
            throw new RaiseLogicException();
        }
    }
    /**
     * Get the unit that this converter will convert the subject to
     * @return string|integer|double
     */
    public function to(){
        return $this->to;
    }

    /**
     * Get the unit that this converter will convert the subject from
     * @return string|integer|double
     */
    public function from(){
        return $this->from;
    }

    
}
